<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="keywords" content="pinpin社保" />
	<meta name="description" content="pinpin社保" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>社保运营后台-补缴列表</title>
	<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
</head>
<body>
	<div id="wrapper">
        <%@ include file="/WEB-INF/jsp/common/menu.jsp" %>
        <div id="page-wrapper">
        	<div class="row">
                <div class="col-lg-12">
                    <!-- 路径导航 -->
                    <ol class="breadcrumb">
				      <li>社保后台</li>
				      <li class="active">补缴列表</li>
				    </ol>
                </div>
            </div>
            <div class="row">
            	<div class="col-lg-12">
            		<div class="panel panel-default">
            			<div class="panel-body">
        			    	<div class="form-inline dt-bootstrap no-footer">
        			    		<!-- 表单查询 -->
        			    		<form action="" method="POST" class="form-check" id="queryForm">
        			    		<div class="row">
        			    			<div class="col-lg-12">
		    							<div class="form-group">
		    								<label for="order_start_time">身份证号：</label>
        			    					<input type="text" class="form-control" name="id_card" placeholder="身份证号" value="${id_card }"/>
        			    				</div>
        			    			    <div class="form-group">
		    								<label for="order_start_time">付款状态：</label>
	                                        <select class="form-control" name="status">
	                                            <option value="">全部付款状态</option>
	                                            <option value="1" <c:if test="${status eq 1 }">selected="selected"</c:if>>待付款</option>
	                                            <option value="2" <c:if test="${status eq 2 }">selected="selected"</c:if>>完成付款</option>
	                                        </select>
		    							</div>        			    			    
		    							<div class="form-group">
		    								<label for="order_start_time">城市：</label>
	        			    			    <c:set var="citySelectPCitys" value="${pCityList }" scope="request"/>
	                                        <c:set var="citySelectCitys" value="${cityList }" scope="request"/>
	                                        <jsp:include page="/WEB-INF/jsp/common/citySelect.jsp">
	                                        	<jsp:param name="id" value="city_code" />
	                                        	<jsp:param name="name" value="city_code" />
	                                        	<jsp:param name="value" value="${city_code }" />
	                                        </jsp:include>
		    							</div>
        			    			    <div class="form-group">
		    								<label for="order_start_time">支付日期：</label>
					   						<input type="text" class="form-control" name="beginPayTime" placeholder="开始支付时间" onClick="WdatePicker()" value="${beginPayTime }"> <label style="margin-right: 12px;"> ~ </label>   
					   						<input type="text" class="form-control" name="endPayTime" placeholder="支付时间" onClick="WdatePicker()"  value="${endPayTime }">
		    							</div>
										<div class="form-group">
											<label for="order_start_time">最后更新时间：</label>
											<input type="text" class="form-control" name="beginGenTime" placeholder="最后更新时间" onClick="WdatePicker()" value="${beginGenTime }"> <label style="margin-right: 12px;"> ~ </label>
											<input type="text" class="form-control" name="endGenTime" placeholder="最后更新时间" onClick="WdatePicker()"  value="${endGenTime }">
										</div>
										<div class="form-group">
											<label for="order_start_time">关联月份：</label>
											<input type="text" class="form-control" name="month" id="month" value="${month }" placeholder="选择月份" size="12" title="选择月份"
												   onClick="WdatePicker({dateFmt:'yyyyMM',minDate:'2015-10-01 00:00:00'})" onblur="return checkDate()"></label>
										</div>

        			    			    <button type="submit" class="btn btn-primary">查 询</button>
        			    			    <button type="button" id="resetBtn" class="btn btn-primary">重置</button>
        			    			</div>
        			    		</div>
        			    		</form>
        			    		<!-- 分页 -->
        			    		<div class="row">
									<div class="col-lg-1">
										<button class="btn btn-primary btn-sm" id="export" onclick="javascript:exportExcel();">导出为EXCEL</button>
									</div>
        			    			<div class="col-lg-1">
        			    			</div>
        			    			<div class="col-lg-10">
        			    				<jsp:include page="/WEB-INF/jsp/common/page.jsp">
        			    					<jsp:param name="formId" value="queryForm"/>
        			    				</jsp:include>
        			    			</div>
        			    		</div>
        			    		<!-- 表格列表 -->
        			    		<div class="row">
        			    			<div class="col-lg-12 width-auto">
        			    				<table id="dataContent" class="table table-striped table-bordered table-hover no-footer" role="grid">
        			    					<thead>
        			    						<tr>
                                                    <th>补差额交易号  / 支付流水号</th>
                                                    <th>关联月份</th>
                                                    <th>关联订单</th>
                                                    <th>标题</th>
                                                    <th>参保人</th>
													<th>联系方式</th>
                                                    <th>城市</th>
                                                    <th>每单金额</th>
                                                    <th>原因</th>
                                                    <th>状态</th>
                                                    <th>操作</th>
                                                    <th>最新更新时间</th>
                                                    <th>支付时间</th>
                                                </tr>
        			    					</thead>
        			    					<tbody>
        			    					<c:forEach items="${pageModel.recordList }" var="l">
	        			    					<tr role="row" <c:if test="${l.status == 1 }">class="warning"</c:if><c:if test="${l.status == 5 || l.status == 11 }">class="danger"</c:if>>
                                                    <td style="text-align:left;"><p>${l.added_no } </p>
                                                    	<c:if test="${l.status gt 1 }"><div class="text-info"><b>${l.pay_no }</b></div></c:if>
                                                    </td>
                                                    <td>
                                                    	<c:set value="${ fn:split(l.months, ',') }" var="months" />
														<c:forEach items="${months }" var="m">
															<p>${m }</p> 
														</c:forEach>
                                                    </td>
                                                    <td>
					                                    <c:set value="${ fn:split(l.orders, ',') }" var="orderItems" />
														<c:forEach items="${orderItems }" var="orderItem">
															<p><a href="${added_view_uri }?order_no=${orderItem }" target="_blank">${orderItem }</a></p> 
														</c:forEach>
                                                    </td>
                                                    <td>${l.title }</td>
                                                    <td style="text-align:right">${l.user_name } &nbsp;&nbsp; ${l.id_card }</td>
													<td>${l.phone}</td>
                                                    <td>${l.city_name }</td>
                                                    <td>￥${l.amount }</td>
                                                    <td>${l.reason }</td>
                                                    <td> 
                                                    	<c:forEach var="ostatus" items="${orderStatus }">
			                                            	<c:if test="${l.status == ostatus.num }">
			                                            		${ostatus.name }
			                                            		<c:set var="exitId" value="0"></c:set> <!-- break -->
			                                            	</c:if>
			                                            </c:forEach>
			                                        </td>
                                                    <td>
                                                    	<c:if test="${l.status == 1 }">
                                                    		<a href="javascript:del('${l.added_no}');" id="del${l.added_no}">删除</a>
                                                    	</c:if>
                                                    </td>
                                                    <td>${l.gen_time }</td>
                                                    <td>${l.pay_time }</td>
        			    					</c:forEach>

        			    					</tbody>
        			    				</table>
        			    				
        			    			</div>
        			    		</div>
        			    		<!-- 分页 -->
        			    		<div class="row">
        			    			<div class="col-lg-2">
        			    			</div>
        			    			<div class="col-lg-10">
        			    				<jsp:include page="/WEB-INF/jsp/common/page.jsp">
        			    					<jsp:param name="formId" value="queryForm"/>
        			    				</jsp:include>
        			    			</div>
        			    		</div>
        			    		
        			    	</div>
            			</div>
            		</div>
            	</div>
            </div>
        </div>
	</div>
	
</body>
    <script lang="text/javascript">
    var del_uri = "${del_uri}";
    var export_uri = "${export_uri}";
    $(function() {
    	$("#resetBtn").click(function(){
    		$("#queryOrderForm").find("input[type=text],select").filter(function(index) {
				  return $(this).attr("dataType") != "city_select";
			}).val("");
    	});
    });
    

    function del(added_no) {
    	$.get(del_uri+"?added_no="+added_no, function(result, textStatus) {
    		if (result.code != 200) {
    			smokeAlert(result.code, result.msg);
    		} else {
    			window.location.reload();
    		}
    	});
    }

    function exportExcel() {
 	    var data = $("#queryForm").serialize();
 	    var inputs = '';
        jQuery.each(data.split('&'), function(){
        	var pair = this.split('=');
            inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />';
        });
        // request发送请求
        jQuery('<form action="'+export_uri+'" method="post">'+inputs+'</form>')
        	.appendTo('body').submit().remove();
    }
    
    </script>
</html>